package java_class_work.week06;

import java.util.LinkedList;
import java.util.ListIterator;

/**
 * @Auther: admin
 * @Date: 2022/10/17 11:24
 * @Description:
 *
 */

public class LinkedListDemo01 {
    public static void main(String[] args) {
        LinkedList<String> ll = new LinkedList<>();
        ll.add("advocate");
        ll.add("endeavour");
        ll.add("insulate");
        ll.add("incompatible");
        // ListIterator 迭代器， 指定从 第4个开始
        ListIterator<String> sll = ll.listIterator(4);
        // 倒序迭代
        while (sll.hasPrevious()){
            System.out.println(sll.previous());
        }
        //再正序迭代
        while (sll.hasNext()){
            System.out.println(sll.next());
        }
    }
}
